<template>
  <div class="message-list-cont">
      <div class="mess-wrapper" v-for="(item, index) in messageMeetListSli" :key="index">
          <div class="mess-left">
              <div :class="item.isread == 0 ? 'bg blue':'bg grey'"></div>
              <div class="info">
                  <!-- 请前往<span class="choose" @click="goToDetail(item,index)">{{'工作池'}}</span> -->
                  <div>{{item.theme}}<Button type="primary" size="small" v-if="item.meetingtype=='会议进行中'" class="ml10">会议进行中</Button><Button type="warning" size="small" v-else class="ml10">{{item.meetingtype}}</Button></div>
                  <div class="grey-font"><Icon class="mr10" type="ios-time" />{{item.startdate}} - {{item.enddate}}</div>
                  <div class="grey-font"><Icon class="mr10" type="ios-pin" />{{item.address}}</div>
                  <div class="grey-font"><Icon class="mr10" type="ios-paper" />{{item.filename}}</div>
              </div>
          </div>
          <div class="mess-right"><Button type="primary" @click="goToDetail(item,index)">确定</Button></div>
      </div>
      <div class="message-page">
        <Page v-show="messageMeetList.length > 0" @on-change="changePage" :current="currentPage" :total="total" :page-size="pageSize" />
      </div>
      <div class="tc" v-show="messageMeetList.length == 0">暂无通知</div>

  </div>
</template>
<script>
export default {
  name: 'messMeet',
  props: ["messageMeetList",],
  data() {
    return {
        messageMeetListSli:[],
        currentPage:1,
        pageSize:10,
        total:1,
        // current: "messageSys",
        // messageSys: 1,
        // messageMeet: 0,
        // messageEdu: 5,
        // messageCheck: 0,
        // messageEval: 0,
        // messageKnow: 0,
    };
  },
  methods: {
      goToDetail(item,index){
        let obj={
          type:2,
          idList:item.meetSerialNo
        }
        this.api.updateWorkDiaryReadNotice(obj).then(res => {
          console.log(res)
          this.$store.commit('messageHasChangedFreshedQuickly', 'meet'+item.meetSerialNo);

          //先置为已读，再跳转
          this.$router.push({
              path:'/U/meetingManagement/mettingInfo',
              query: {
                item:item,
                meetingFlag:1
              }
          })
        })
          //先置为已读，再跳转
        // this.$router.push({
        //     name:'mettingNotice',
        //     query: {
        //         item:{
        //             meetSerialNo: '1285760621783101442'
        //         },
        //         meetingFlag:1
        //     }

        // })
      },
      changePage(num){
        this.currentPage = num
        this.messageMeetListSli = this.messageMeetList.slice((this.currentPage-1)*this.pageSize, this.currentPage*this.pageSize)

      }

  },
  watch:{
    messageMeetList(){
      console.log("0meetwatch",this.messageMeetList)

      this.total = this.messageMeetList ? this.messageMeetList.length : 0
      this.messageMeetListSli = this.messageMeetList.slice((this.currentPage-1)*this.pageSize, this.currentPage*this.pageSize)

    }
  },
  mounted() {
      this.currentPage = 1
      console.log("0meet",this.messageMeetList)
      this.total = this.messageMeetList ? this.messageMeetList.length : 0
      // this.messageMeetListSli = this.messageMeetList.slice((this.currentPage-1)*this.pageSize, this.currentPage*this.pageSize)
      this.messageMeetListSli = this.messageMeetList

  }
};
</script>
<style lang="less">
@import "../index.less";
</style>